function getCodecByAjax(ajaxUrl, params){
	var obj = new Object();
	obj.async = false;
	obj.data = contructParams(params);
	obj.returnData = "";
	$j.ajax({
		type: "POST",
		url: ajaxUrl,
		data:obj.data,
		dataType: "text",
		cache:true,
		async:false,
		success: function(data, textStatus, XMLHttpRequest){
		   obj.returnData = data;
		},
		error: function(XMLHttpRequest, textStatus, errorThrown){
			alert("ajax error");
		}
	});
	return obj.returnData;
}

function contructParams(params){
	var strall = "";
	if( $j.isArray(params)){
		var strall = "count="+params.length;
		for(var i=0; i<params.length; i++){
			strall = strall + "&str"+i+"=" + params[i];
		}
		return strall;
	}else{
		return "count=1&str1="+params;
	}
}

function getParameterMap(paraStr){ 
	var paraArr = paraStr.split("&"); 
    var paraObj = [];
    for (var i=0; j=paraArr[i]; i++){ 
    	var key = j.substring(0,j.indexOf("=")).toLowerCase();
    	var val = j.substring(j.indexOf("=")+1,j.length);
    	paraObj[key] = val;
    }
    return paraObj; 
}

function getParameterValue(paraString, paras){ 
    var paraObj = getParameterMap(paraString);
    var returnValue = paraObj[paras.toLowerCase()]; 
    if(typeof(returnValue)=="undefined"){ 
    	return ""; 
    }else{ 
    	return returnValue; 
    } 
}

//var codecArr = getCodecValues("${ctx}/webutil/codec.htm", ["中","国","人"]);
function getCodecValues(ajaxUrl, params){
	var codecStr = getCodecByAjax(ajaxUrl, params);
	var paramMap = getParameterMap(codecStr);
	var count = paramMap["count"];
	if(count==1){
		return paramMap["str0"];
	}
	var codecArr = new Array();
	for(var i=0; i<count; i++){
		codecArr[codecArr.length++] = paramMap["str"+i];
	}
	return codecArr;
}